package com.imnc.eatmap.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.baidu.mapapi.search.MKPoiInfo;
import com.baidu.platform.comapi.basestruct.GeoPoint;

public class PoiInfoParcelable extends MKPoiInfo implements Parcelable {
	public PoiInfoParcelable() {
	}

	public PoiInfoParcelable(MKPoiInfo poiInfo) {
		this.address = poiInfo.address;
		this.city = poiInfo.city;
		this.ePoiType = poiInfo.ePoiType;
		this.name = poiInfo.name;
		this.phoneNum = poiInfo.phoneNum;
		this.postCode = poiInfo.postCode;
		this.pt = poiInfo.pt;
		this.hasCaterDetails = poiInfo.hasCaterDetails;
		this.isPano = poiInfo.isPano;
		this.uid = poiInfo.uid;
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(this.address);
		dest.writeString(this.city);
		dest.writeString(this.name);
		dest.writeString(this.phoneNum);
		dest.writeString(this.postCode);
		dest.writeInt(this.ePoiType);
		dest.writeInt(this.pt.getLatitudeE6());
		dest.writeInt(this.pt.getLongitudeE6());
		dest.writeString(this.uid);
	}

	public final static Parcelable.Creator<PoiInfoParcelable> CREATOR = new Creator<PoiInfoParcelable>() {
		@Override
		public PoiInfoParcelable[] newArray(int size) {
			return new PoiInfoParcelable[size];
		}

		@Override
		public PoiInfoParcelable createFromParcel(Parcel source) {
			PoiInfoParcelable poiInfo = new PoiInfoParcelable();
			poiInfo.address = source.readString();
			poiInfo.city = source.readString();
			poiInfo.name = source.readString();
			poiInfo.phoneNum = source.readString();
			poiInfo.postCode = source.readString();
			poiInfo.ePoiType = source.readInt();
			poiInfo.pt = new GeoPoint(source.readInt(), source.readInt());
			poiInfo.uid = source.readString();
			return poiInfo;
		}
	};
}